<admintpl file="header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="javascript:;">资讯管理</a></li>
			<li><a href="{:U('News/add')}" target="_self">添加资讯</a></li>
		</ul>
		<form class="well form-search" method="post" action="{:U('News/index')}">
			分类： 
			<select name="news_cat_id" style="width: 120px;">
				<option value='0'>全部</option>
				<foreach name="cat" item="vo">
					<php>$cid_select=$vo['cid']==$news_cat_id?"selected":"";</php>
					<option value='{$vo.cid}' {$cid_select}>{$vo.cat_name}</option>
				</foreach>
			</select> &nbsp;&nbsp;
			时间：
			<input type="text" name="start_time" class="js-datetime" value="{$formget.start_time|default=''}" style="width: 120px;" autocomplete="off">-
			<input type="text" class="js-datetime" name="end_time" value="{$formget.end_time|default=''}" style="width: 120px;" autocomplete="off"> &nbsp; &nbsp;
			关键字： 
			<input type="text" name="keyword" style="width: 200px;" value="{$formget.keyword|default=''}" placeholder="请输入关键字...">
			<input type="submit" class="btn btn-primary" value="搜索" />
			<a class="btn btn-danger" href="{:U('News/index')}">清空</a>
		</form>
		<form class="js-ajax-form" action="" method="post">
			<div class="table-actions">
				<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U('News/listorders')}">排序</button>
				<button class="btn btn-danger btn-small js-ajax-submit" type="submit" data-action="{:U('News/delete')}" data-subcheck="true" data-msg="您确定删除吗？">删除</button>
			</div>
			<table class="table table-hover table-bordered table-list">
				<thead>
					<tr>
						<th width="15"><label><input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x"></label></th>
						<th width="50">排序</th>
						<th width="50">ID</th>
						<th>标题</th>
						<th width="50">作者</th>
						<th>来源</th>
						<th>摘要</th>
						<th width="50">点击量</th>
						<th width="160">缩略图</th>
						<th width="120">发布时间</th>
						<th width="50">状态</th>
						<th width="70">操作</th>
					</tr>
				</thead>
				<foreach name="posts" item="vo">
				<tr>
					<td>
						<!--<input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]" value="{$vo.id}">-->
						<input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]" value="{$vo.id}">
					</td>
					<td><input name="listorders[{$vo.id}]" class="input input-order" type="text" size="5" value="{$vo.listorder}"></td>
                    <td><b>{$vo.id}</b></td>
					<td>
						<notempty name="news_cat_id">
						<a href="{:leuu('portal/article/index',array('id'=>$vo['id'],'cid'=>$news_cat_id))}" target="_blank">{$vo.news_title}</a>
						<else/>
							{$vo.news_title}
						</notempty>
					</td>
					<td>{$vo.user_nicename|default=$vo.user_login}</td>
					<td>{$vo.news_source}</td>
					<td>{$vo.news_excerpt}</td>
					<td>{$vo.news_hits}</td>
					<td>
						<php>$smeta=json_decode($vo['smeta'],true);</php>
						<notempty name="smeta.thumb">
							<a href="javascript:parent.image_preview_dialog('{:sp_get_image_preview_url($smeta['thumb'])}');">
								<i class="fa fa-photo fa-fw"></i>
							</a>
						</notempty>
					</td>
					<td>{:date('Y-m-d H:i',strtotime($vo['news_date']))}</td>
					<td>
						<notempty name="vo.post_status">
							<a data-toggle="tooltip" title="已启用"><i class="fa fa-check"></i></a>
							<else/>
							<a data-toggle="tooltip" title="已禁用"><i class="fa fa-close"></i></a>
						</notempty>
					</td>
					<td>
						<a href="{:U('News/edit',array('id'=>$vo['id'],'p'=>$p))}">编辑</a> |
						<a href="{:U('News/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">删除</a>
					</td>
				</tr>
				</foreach>
				<tfoot>
					<tr>
						<th width="15"><label><input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x"></label></th>
						<th width="50">排序</th>
						<th width="50">ID</th>
						<th>标题</th>
						<th width="50">作者</th>
						<th>来源</th>
						<th>摘要</th>
						<th width="50">点击量</th>
						<th width="160">缩略图</th>
						<th width="120">发布时间</th>
						<th width="50">状态</th>
						<th width="70">操作</th>
					</tr>
				</tfoot>
			</table>
			<div class="table-actions">
				<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U('News/listorders')}">排序</button>
				<button class="btn btn-danger btn-small js-ajax-submit" type="submit" data-action="{:U('News/delete')}" data-subcheck="true" data-msg="你确定删除吗？">删除</button>
			</div>
			<div class="pagination">{$page}</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script>
		function refersh_window() {
			var refersh_time = getCookie('refersh_time');
//			alert(refersh_time);
			if (refersh_time == 1) {
				window.location = "{:U('AdminPost/index',$formget)}";
			}
		}
		setInterval(function() {
			refersh_window();
		}, 2000);
	</script>
</body>
</html>